﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml.Linq;

namespace SaleOffVn.Web.MasterPages
{
    public partial class HomeMaster : System.Web.UI.MasterPage
    {
        private string visitedLinkColor = "#889539";

        public string VisitedLinkColor
        {
            get { return visitedLinkColor; }
            set { visitedLinkColor = value; }
        }

        private string activeBanner = "";
        public string ActiveBanner
        {
            get { return activeBanner; }
            set { activeBanner = value; }
        }  
        protected void Page_Load(object sender, EventArgs e)
        {
            string strJSFile;
            /* don tran  - 09-03-20108*/
            strJSFile = this.ResolveClientUrl("~/Scripts/jquery-1.4.2.min.js");
            Page.ClientScript.RegisterClientScriptInclude(this.GetType(), "addScript", strJSFile);

            strJSFile = this.ResolveClientUrl("~/Scripts/jquery.betterTooltip.js");
            Page.ClientScript.RegisterClientScriptInclude(this.GetType(), "addScript3", strJSFile);

            /* thom nguyen  - 09-03-20108*/
            strJSFile = this.ResolveClientUrl("~/Scripts/master.js");
            Page.ClientScript.RegisterClientScriptInclude(this.GetType(), "addScript2", strJSFile);

            
                       
            if (activeBanner.ToLower() == "home")
            {
                homeBar.Attributes.Remove("class");
                homeBar.Attributes.Add("class", "home-topbar-on");
                
                hlkhome_topbar.Attributes.Remove("class");
                hlkhome_topbar.Attributes.Add("class", "home-topbar-active");
            }
            else if (activeBanner.ToLower() == "contactus")
            {
                contactBar.Attributes.Remove("class");
                contactBar.Attributes.Add("class", "contact-topbar-on");

                //masterPicTop.Attributes.Remove("class");
                //masterPicTop.Attributes.Add("class", "master-pic-contact");

                master_wrapper_content.Attributes.Remove("class");
                master_wrapper_content.Attributes.Add("class", "master-wrapper-content-careers");

            }
            else if (activeBanner.ToLower() == "news")
            {
                newsBar.Attributes.Remove("class");
                newsBar.Attributes.Add("class", "news-topbar-on");

                //masterPicTop.Attributes.Remove("class");
                //masterPicTop.Attributes.Add("class", "master-pic-news");

                master_wrapper_content.Attributes.Remove("class");
                master_wrapper_content.Attributes.Add("class", "master-wrapper-content-careers");                            

            }
            else if (activeBanner.ToLower() == "careers")
            {
                careersBar.Attributes.Remove("class");
                careersBar.Attributes.Add("class", "careers-topbar-on");

                //masterPicTop.Attributes.Remove("class");
                //masterPicTop.Attributes.Add("class", "master-pic-careers");
                
                master_wrapper_content.Attributes.Remove("class");
                master_wrapper_content.Attributes.Add("class", "master-wrapper-content-careers");
            }
            else if (activeBanner.ToLower() == "search")
            {                
                masterPicTop.Attributes.Remove("class");
                //masterPicTop.Attributes.Add("class", "master-pic-search");
                // Dinh Nguyen 2010-08-30
                //masterPicTop.Attributes.Add("class", "master-pic-contact");
                
                master_wrapper_content.Attributes.Remove("class");
                master_wrapper_content.Attributes.Add("class", "master-wrapper-content-careers");
            }
            else if (activeBanner.ToLower() == "sitemap")
            {
                
                //masterPicTop.Attributes.Remove("class");
                //masterPicTop.Attributes.Add("class", "master-pic-contact");

                master_wrapper_content.Attributes.Remove("class");
                master_wrapper_content.Attributes.Add("class", "master-wrapper-content-careers");
            }
                
            else if (activeBanner.ToLower() == "corporateinfo")
            {
                masterPicTop.Attributes.Remove("class");
                masterPicTop.Attributes.Add("class", "master-pic-corporateinfo");
            }
            else if ((activeBanner.ToLower() == "corporateinfo-aboutus") ||
                (activeBanner.ToLower() == "corporateinfo-advisors") ||
                (activeBanner.ToLower() == "corporateinfo-engagement") ||
                (activeBanner.ToLower() == "corporateinfo-facilities") ||
                (activeBanner.ToLower() == "corporateinfo-management") ||
                (activeBanner.ToLower() == "corporateinfo-processes"))
            {
                //masterPicTop.Attributes.Remove("class");
                //masterPicTop.Attributes.Add("class", "master-pic-corporateinfo");

                aboutusBar.Attributes.Remove("class");
                aboutusBar.Attributes.Add("class", "aboutus-topbar-on");
            }
                
            else if (activeBanner.ToLower() == "expertise-app-dev")
            {
                //masterPicTop.Attributes.Remove("class");
                //masterPicTop.Attributes.Add("class", "master-pic-expertise-app-dev");
            }
            else if (activeBanner.ToLower() == "expertise-embed-software")
            {
                //masterPicTop.Attributes.Remove("class");
                //masterPicTop.Attributes.Add("class", "master-pic-expertise-embed-software");
            }
            else if (activeBanner.ToLower() == "expertise-datacom")
            {
                //masterPicTop.Attributes.Remove("class");
                //masterPicTop.Attributes.Add("class", "master-pic-expertise-datacom");
            }
            else if (activeBanner.ToLower() == "expertise-testing")
            {
                //masterPicTop.Attributes.Remove("class");
                //masterPicTop.Attributes.Add("class", "master-pic-expertise-testing");
            }                
            else if (activeBanner.ToLower() == "industries")
            {
                //masterPicTop.Attributes.Remove("class");
                //masterPicTop.Attributes.Add("class", "master-pic-industries");
            }
            else if (activeBanner.ToLower() == "industries-telecom")
            {
                //masterPicTop.Attributes.Remove("class");
                //masterPicTop.Attributes.Add("class", "master-pic-industries-telecom");
            }
            else if (activeBanner.ToLower() == "industries-automotive")
            {
                //masterPicTop.Attributes.Remove("class");
                //masterPicTop.Attributes.Add("class", "master-pic-industries-automotive");
            }
            else if (activeBanner.ToLower() == "industries-ecommerce")
            {
                //masterPicTop.Attributes.Remove("class");
                //masterPicTop.Attributes.Add("class", "master-pic-industries-ecommerce");
            }
            else if (activeBanner.ToLower() == "industries-mobiledevices")
            {
                //masterPicTop.Attributes.Remove("class");
                //masterPicTop.Attributes.Add("class", "master-pic-industries-mobiledevices");
            }
            else if (activeBanner.ToLower() == "why")
            {
                //masterPicTop.Attributes.Remove("class");
                //masterPicTop.Attributes.Add("class", "master-pic-why");
            }
            
        }

        /*
         * No longer needed, do nothing for now.
         */ 
        public void CollapseAll()
        {
            //// show all OFF menus
            //this.menu_corporate_info_off.Visible = true;
            //this.menu_expertise_off.Visible = true;
            //this.menu_industries_off.Visible = true;
            //this.menu_why_off.Visible = true;

            //// hide all ON menus
            //this.menu_corporate_info_on.Visible = false;
            //this.menu_expertise_on.Visible = false;
            //this.menu_industries_on.Visible = false;
            //this.menu_why_on.Visible = false;
        }

        public void ShowMenu(string menuId, int menuIndex)
        {
            /*
            switch (menuId)
            {
                case "Menu_Corporate":
                    this.menu_corporate_info_off.Visible = false;
                    this.menu_corporate_info_on.Visible = true;
                    break;
                case "Menu_Expertise":
                    this.menu_expertise_off.Visible = false;
                    this.menu_expertise_on.Visible = true;
                    break;
                case "Menu_Industries":
                    this.menu_industries_off.Visible = false;
                    this.menu_industries_on.Visible = true;
                    break;
                case "Menu_Why":
                    this.menu_why_off.Visible = false;
                    this.menu_why_on.Visible = true;
                    break;
                default:
                    break;
            }

            // highlight menu item
            HyperLink link = (HyperLink)FindControl(String.Format("{0}{1}", menuId, menuIndex.ToString()));
            //link.ForeColor = System.Drawing.Color.Red;
            link.ForeColor = System.Drawing.Color.FromName(visitedLinkColor);
            link.Font.Bold = true;
             */
        }
    }
}